package in.muton.edushare.pages.batch;

import org.apache.wicket.PageParameters;
import org.apache.wicket.model.IModel;

import com.edushare.common.constants.ApplicationConstants;
import com.edushare.common.vo.Batches;

public class BatchEditPage extends BatchBase {

	public BatchEditPage(PageParameters params){
		super(params);
		add(new NewBatch("editPanel", getParametersForPanel(super.batchModel), this));
	}
	
	public BatchEditPage(IModel<Batches> batchModel){
		super(batchModel);
		add(new NewBatch("editPanel", getParametersForPanel(super.batchModel), this));
	}
	
	private PageParameters getParametersForPanel(IModel<Batches> iModel) {
		PageParameters params = new PageParameters();
		params.add("0", batchModel.getObject().getCurricula().getUniversity().getUniqueName());
		params.add("1", ""+batchModel.getObject().getCurricula().getCurriculaId());
		params.add("2", ""+batchModel.getObject().getBatchId());
		params.add("3", batchModel.getObject().getCurricula().getDepartment().getDepartmentId().toString());
		return params;
	}

	@Override
	public String getActivePage() {
		return "batchEdit";
	}

	@Override
	public String getPageTitle() {
		return "Edit Batch | " + batchModel.getObject().getBatchName() + " | " + ApplicationConstants.APPLICATION_NAME;
	}

}
